<?php
/*\
 *	
 *	
 *	
 *	
\*/

function dmodel_get_meta($id,$key) {
	$p = dmodel_get_prefix("");
	$q = "SELECT meta_value FROM {$p}meta WHERE meta_object='{$id}' AND meta_key='{$key}'";
	$r = dmodel_query($q,"resultset");
	if (count($r)>0) {
		return $r[0]->meta_value;
	} else {
		return "";
	}
}

function dmodel_set_meta($id,$key,$value) {
	$p = dmodel_get_prefix("");
	$q = "INSERT INTO {$p}meta(meta_object,meta_key,meta_value,meta_mood) VALUES ('{$id}','{$key}','{$value}',1)";
	$r = dmodel_query($q,"lastid");
}

function dmodel_new_meta($id,$key,$value) {
	$p = dmodel_get_prefix("");
	$q = "INSERT INTO {$p}meta(meta_object,meta_key,meta_value,meta_mood) VALUES ('{$id}','{$key}','{$value}',1)";
	$r = dmodel_query($q,"lastid");
}
